package com.le.servlet;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class getc extends servlet{
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
        resp.setCharacterEncoding("utf-8");
        ServletContext context=this.getServletContext();

        String username= (String) context.getAttribute("username");
      InputStream is= context.getResourceAsStream("/WEB-INF/classes/s2.properties");
        Properties properties=new Properties();
        properties.load(is);
        String user=properties.getProperty("username");

        try {
            resp.getWriter().println(username);
            resp.getWriter().println(user);
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
